package top.rushpeak.edu03.admin.job;

import java.net.MalformedURLException;
import java.util.Date;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import com.caucho.hessian.client.HessianProxyFactory;

import top.rushpeak.edu03.admin.util.DateUtil;
import top.rushpeak.edu03.api.service.HelloService;


public class DynamicJob extends AbstractJob implements Job {

	public static String urlName = "http://localhost:8081/helloService";
	
	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		
	    try {
	    	System.out.println("王世林吃瓜："+DateUtil.dateFormat(new Date(), "yyyyMMddHHmmss"));
	    	HessianProxyFactory factory = new HessianProxyFactory();
	    	// 开启方法重载
	    	factory.setOverloadEnabled(true);
			HelloService helloService = (HelloService) factory.create(HelloService.class, urlName);
			String say = helloService.say();
			System.out.println("say:"+say);
		} catch (MalformedURLException e) {
			LOG.error("e=="+e);
		}
	    
	}

}
